package com.hqyj.controller;

import com.hqyj.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@Controller
public class LoginController {

    @RequestMapping("/login")
    public String login(){
        return "login";
    }

    @RequestMapping("/")
    public String loginOut(){
        return "login";
    }

    @RequestMapping("/caiping")
    public String caiping(Model model){

        return "caipingguanli/caiping";
    }

    @RequestMapping("/categoryList")
    public String categoryList(){
        return "caipingguanli/categoryList";
    }

    @RequestMapping("/shangcaibumen")
    public String shangcaibumen(HttpServletRequest request, String department){
        request.setAttribute("info",department);
        return "shangcai/shangcai";
    }

    @RequestMapping("/tablelist")
    public String tablelist(){
        return "reserve/tableInfo";
    }

    @RequestMapping("/cj")
    public String cj(HttpServletRequest request){
        HttpSession session = request.getSession();
        Integer sysId = Integer.parseInt(session.getAttribute("sysId")+"");
        request.setAttribute("sysId",sysId);
        return "caijia/cj";
    }

    @RequestMapping("/shenhe")
    public String shenhe(HttpServletRequest request){
        HttpSession session = request.getSession();
        String sysName = ((User)session.getAttribute("USER")).getSysName();
        request.setAttribute("sysName",sysName);
        return "caijia/shenhe";
    }

    @RequestMapping("/kaoqingone")
    public String kaoqingone(HttpServletRequest request){
        HttpSession session = request.getSession();
        Integer sysId = Integer.parseInt(session.getAttribute("sysId")+"");
        request.setAttribute("sysId",sysId);
        return "kaoqing/kaoqingone";
    }

    @RequestMapping("/table")
    public String table(HttpServletRequest request){
        return "kaoqing/table";
    }

    @RequestMapping("/personnel")
    public String personnel(HttpServletRequest request){
        return "yuangongxingxi/personnel";
    }

    @RequestMapping("/user")
    public String user(HttpServletRequest request){
        HttpSession session = request.getSession();
        Integer sysId = Integer.parseInt(session.getAttribute("sysId")+"");
        request.setAttribute("sysId",sysId);
        return "yuangongxingxi/user";
    }




}